package com.qyi.activemq.queue.producer;

import lombok.extern.slf4j.Slf4j;
import org.apache.activemq.command.ActiveMQQueue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service;

/**
 * @author luqi
 * @Date 2021/3/11 10:07
 * @Description TODO
 */
@Service
@Slf4j
public class MqProducerService {

    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    public void sendQueue(String msg) {
        msg = msg + "," + System.currentTimeMillis();
        log.info("producer q1-queue:{}", msg);
        jmsMessagingTemplate.convertAndSend(new ActiveMQQueue("q1-queue"), msg);
    }

}
